Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Examples,PeriphDrivers): Add I2C_ADXL343 example to MAX32690, fix double read backs for I2C repeated start condition in ADXL343 drivers, and add minor I2C MasterTransaction Sync fix #1211

Merged
merged 15 commits into from
Oct 8, 2024

Conversation

sihyung-maxim
Copy link
Contributor

@sihyung-maxim sihyung-maxim commented Oct 4, 2024

Description

  • Adds the I2C_ADXL343 example to the MAX32690.
  • Reformat I2C transactions in ADXL343 drivers to account for repeated start condition (shortening for RSC) protocol used with ADXL343. (More info below).
  • Fix errata rev 2, 16 - Enabling I2C alternate functions disables the functionality of some pins, specifically for I2C2 instance.
  • Use the correct I2C (MSTCTRL.stop) register when the CONTROLLER (prev. MASTER) sets the STOP condition. I2C_INTFL0.stop is for when the device is in TARGET (prev. SLAVE) mode and detects a STOP condition.

When testing on the ME18, the MasterTransaction function doesn't support repeated start conditions in the protocol that ADXL343 supports for all-in-one transaction requests due to how the request struct and the driver's reads logic are set up for a single transaction call (read -> check comm error -> restart read if still expecting more messages -> repeat back to step 1 (read) until all reads finish).

For reference, this is the READ RSC protocol for the ADXL343 (common for other ICs with accessible registers as well).
image

Back to the read logic in the MasterTransaction function, the last step before the repeat (restart read if still expecting more messages) causes a double readback and hanging transaction failures when attempting to run the READ RSC transaction mentioned above. Removing the last step is a temporary workaround to prevent double readbacks and support RSC-type transactions, but it breaks normal/non-RSC I2C transactions.

Adding a solution to support both normal and RSC transactions will be too invasive and require more time to verify. Because this PR has been blocking this upcoming release, investigating further into this matter will have to wait until after the release. For now, I left the I2C drivers (specifically MasterTransaction) as is, similar to our previous releases, and any RSC-type transactions will have to be done (at least for the ADXL343) using two I2C_MasterTransaction calls: the first transaction will be everything that happens BEFORE the second START condition (which is writing which register to read from), and the second transaction will be everything that happens AFTER the second START condition (which is reading the contents of the written register).

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.
  • (Optional) Link any related GitHub issues using a keyword
  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.

@github-actions github-actions bot added the MAX32690 Related to the MAX32690 (ME18) label Oct 4, 2024
@sihyung-maxim
Copy link
Contributor Author

/clang-format-run

@github-actions github-actions bot added the Workflow Related to Workflow development label Oct 4, 2024
@sihyung-maxim
Copy link
Contributor Author

/clang-format-run

@sihyung-maxim sihyung-maxim added the Ready for review Raise "Ready" flag if PR is ready for review after WIP is down. label Oct 4, 2024
@sihyung-maxim sihyung-maxim changed the title feat(Examples,PeriphDrivers): Add I2C_ADXL343 example to MAX32690 and fix double read backs for I2C repeated start condition in ADXL343 drivers feat(Examples,PeriphDrivers): Add I2C_ADXL343 example to MAX32690, fix double read backs for I2C repeated start condition in ADXL343 drivers, and add minor I2C MasterTransaction Sync fix Oct 8, 2024
@sihyung-maxim sihyung-maxim merged commit 79c0d9a into main Oct 8, 2024
16 checks passed
@sihyung-maxim sihyung-maxim deleted the feat/me18_adxl343_example branch October 8, 2024 20:33
sihyung-maxim pushed a commit to analogdevicesinc/hal_adi that referenced this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MAX32690 Related to the MAX32690 (ME18) Ready for review Raise "Ready" flag if PR is ready for review after WIP is down. Workflow Related to Workflow development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants